import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';
import Record from 'choerodon-ui/pro/lib/data-set/Record';
import DataSet from 'choerodon-ui/pro/lib/data-set';

const DateDs = () => ({
  primaryKey: 'id',
  queryUrl: '/_api/tree/basic',
  autoQuery: true,
  parentField: 'parentId',
  expandField: 'expand',
  idField: 'id',
  fields: [
    { name: 'id', type: FieldType.number },
    { name: 'expand', type: FieldType.boolean },
    { name: 'parentId', type: FieldType.number },
  ],
  events: {
    select: ({ record, dataSet }: { record: Record, dataSet: DataSet }) => console.log('select', record, dataSet),
    unSelect: ({ record, dataSet }: { record: Record, dataSet: DataSet }) => console.log('unSelect', record, dataSet),
  },
});

export default DateDs;